import instance from '@/http/index'
/**
 *
 * @param {*} id
 * @returns
 * @zs 获取用户信息
 */
// 获取用户信息
export const getUserInfo = id => {
  return instance({
    url: '/user/getUserInfo',
    method: 'POST',
    data: {
      id
    }
  })
}

/**
 *
 * @param {*} data  account💈password💈name💈sex💈email💈department💈identity
 * @returns
 * @zs 创建管理员
 */

export const createAdminAPI = data => {
  return instance({
    url: '/user/createAdmin',
    method: 'POST',
    data
  })
}

/**
 *
 * @param {*} data id💈name💈sex💈email
 * @returns
 * @zs 获取管理员列表
 */
export const getAdminListAPI = identity => {
  return instance({
    url: '/user/getAdminList',
    method: 'POST',
    data: {
      identity
    }
  })
}

/**
 *
 * @param {*} data id💈name💈sex💈email💈department
 * @returns
 * @zs 编辑管理员信息
 */
export const editAdminAPI = data => {
  return instance({
    url: '/user/editAdmin',
    method: 'POST',
    data
  })
}

/**
 *
 * @param {*} id
 * @returns
 * @zs 将管理员改为普通用户
 */
export const changeIdentityToUserAPI = id => {
  return instance({
    url: '/user/changeIdentityToUser',
    method: 'POST',
    data: {
      id
    }
  })
}

/**
 *
 * @param {*} id
 * @returns
 * @zs 将普通用户改为管理员
 */
export const changeIdentityToAdminAPI = id => {
  return instance({
    url: '/user/changeIdentityToAdmin',
    method: 'POST',
    data: {
      id
    }
  })
}

/**
 *
 * @param {*} id
 * @returns
 * @zs 冻结用户
 */
export const freezeUserAPI = id => {
  return instance({
    url: '/user/freezeUser',
    method: 'POST',
    data: {
      id
    }
  })
}

/**
 *
 * @param {*} id
 * @returns
 * @zs 解冻用户
 */

export const unfreezeUserAPI = id => {
  return instance({
    url: '/user/unfreezeUser',
    method: 'POST',
    data: {
      id
    }
  })
}

/**
 *
 * @param {*} keyword
 * @returns
 * @zs 搜索用户
 */
export const searchUsersAPI = keyword => {
  return instance({
    url: '/user/searchUsers',
    method: 'POST',
    data: {
      keyword
    }
  })
}
/**
 *
 * @param {*} id
 * @returns
 * @zs 获取冻结用户列表
 */
export const getFreezeUserListAPI = () => {
  return instance({
    url: '/user/getFreezeUserList',
    method: 'POST'
  })
}
/**
 *
 * @param {*} id
 * @returns
 * @zs 删除用户
 */
export const deleteUserAPI = id => {
  return instance({
    url: '/user/deleteUser',
    method: 'POST',
    data: {
      id
    }
  })
}
